<template>
  <div>
    <!-- 导航/ -->
    <van-nav-bar
      title="影院"
      :left-text="citys"
      class="cinema-title"
      @click-left="onClickLeft"
      @click-right="onClickRight"
    >
      <template #right>
        <img src="@/assets/images/cinema/tip.png" class="tip" @click="gps" alt />
        <van-icon name="search" size="18" />
      </template>
    </van-nav-bar>

    <!-- 上拉下拉回弹 -->
    <div ref="box" class="box">
      <!-- 定位 -->
      <div class="content">
        <div class="cinemaAddress" @click="address">
          <img src="@/assets/images/cinema/gps.png" alt class="gps" />
          <p>我在: 金水区绿地新都会</p>
        </div>
        <!-- 电影院卡片 -->
        <ul>
          <li v-for="item in list" :key="item.id" class="card" @click="cinemaInfo">
            <div class="top">
              <span class="title">{{item.title}}</span>
              <span class="price">
                {{item.price}}
                <span class="price-q">起</span>
              </span>
            </div>
            <div class="middle">
              <span class="address">{{item.address}}</span>
              <span class="distance">{{item.distance}}</span>
            </div>
            <div class="down">
              <p class="activity">
                <van-tag class="activity-a">惠</van-tag>
                {{item.activity1}}
              </p>
              <p class="activity">
                <van-tag class="activity-b">促</van-tag>
                {{item.activity2}}
              </p>
              <p class="activity">
                <van-tag class="activity-c">卡</van-tag>
                {{item.activity3}}
              </p>
            </div>
          </li>
        </ul>
      </div>
    </div>
  </div>
</template>

<script>
import BScroll from "@better-scroll/core";
import { mapState } from "Vuex";
import { Toast } from "vant";
export default {
  data() {
    return {
      list: [
        {
          title: "耀莱成龙影城（建业店)",
          address: "金水区普惠路77号绿地之窗尚峰座正大乐成",
          price: "19.9元",
          distance: "1.2Km",
          activity1: "我是药神等4部影片特惠",
          activity2: "观影套餐限量特惠",
          activity3: "开卡特惠，每单2张立减2元"
        },
        {
          title: "五一影城",
          address: "管城回族区东风南路尚鼎路",
          price: "19.9元",
          distance: "1.7km",
          activity1: "我是药神等4部影片特惠",
          activity2: "观影套餐限量特惠",
          activity3: "限时¥24促销开卡，首单更优惠，开卡即…"
        },
        {
          title: "五一影城",
          address: "管城回族区东风南路尚鼎路",
          price: "19.9元",
          distance: "1.7Km",
          activity1: "我是药神等4部影片特惠",
          activity2: "观影套餐限量特惠",
          activity3: "开卡特惠，每单2张立减2元"
        },
        {
          title: "耀莱成龙影城（建业店)",
          address: "金水区普惠路77号绿地之窗尚峰座正大乐成",
          price: "19.9元",
          distance: "1.2Km",
          activity1: "我是药神等4部影片特惠",
          activity2: "观影套餐限量特惠",
          activity3: "开卡特惠，每单2张立减2元"
        }
      ]
    };
  },
  computed: {
    ...mapState({
      citys: "cityPosition"
    })
  },
  created() {},
  mounted() {
    let wrapper = this.$refs.box;
    let scroll = new BScroll(wrapper, {
      click: true
    });
  },
  methods: {
    onClickLeft() {
      // this.$router.go(-1);
      this.$router.push({
        name: "cinemaGps"
      });
    },
    onClickRight() {
      Toast("按钮");
    },
    gps() {
      this.$router.push({
        name: "location"
      });
    },
    // 跳转地图页
    address() {
      this.$router.push({
        name: "cinemaAddress"
      });
    },
    // 跳转到影院详情页
    cinemaInfo() {
      this.$router.push({
        name: "cinemaDetail"
      });
    }
  }
};
</script>
<style lang="scss">
</style>

<style lang="scss" scoped>

//导航栏
.van-nav-bar {
  background: #33363d;
  .van-nav-bar__title {
    background: #33363d;
  }
}
.van-nav-bar__text {
  color: #ffffff;
}

.van-nav-bar__title {
  color: #ffffff;
}
.box .card[data-v-d7c6c964] {
  opacity: 1 !important;
}

//~~~~~~~~~~~~~~~~~~~
.cinema-title {
  background-color: #33363d !important;
  margin-bottom: 10px;
}
.van-nav-bar .van-icon {
  color: #7a7a7a !important;
}
.box {
  height: 620px;
  overflow: hidden;

  .content {
    height: 600px;
    padding-bottom: 150px;

    // 地图
    .cinemaAddress {
      width: 100%;
      height: 30px;
      background-color: #33363d;
      margin-top: 12px;
      display: flex;
      justify-content: flex-start;
      align-items: center;
      .gps {
        width: 13px;
        height: 16px;
        margin-left: 21px;
      }
      p {
        margin-left: 15px;
        color: #dfdfdf;
        font-size: 12px;
      }
    }
  }

  .card {
    width: 335px;
    height: 146px;
    border-radius: 6px;
    opacity: 0.5865;
    background-color: #33363d;
    margin: 0 auto;
    margin-top: 15px;
  }
  .top {
    display: flex;
    justify-content: space-between;
    width: 95%;
    height: 20px;
    margin: 0 auto;
    .title {
      font-size: 14px;
      font-weight: bold;
      color: white;
      text-align: left;
      margin-top: 9px;
    }
    .price {
      font-size: 14px;
      margin-top: 9px;
      color: #fbc34a;
      font-weight: bold;
      .price-q {
        color: #dfdfdf;
        font-size: 10px;
        margin-top: 9px;
      }
    }
  }
  .middle {
    display: flex;
    justify-content: space-between;
    width: 95%;
    height: 20px;
    margin: 0 auto;
    margin-top: 15px;
    .address {
      font-size: 12px;
      font-weight: 400;
      color: #dfdfdf;
    }
    .distance {
      font-size: 10px;
      font-weight: 400;
      color: #dfdfdf;
    }
  }
  .down {
    width: 95%;
    text-align: left;
    margin: 0 auto;
    margin-top: -8px;
    .activity {
      font-size: 10px;
      color: #dfdfdf;
      font-weight: 400;
      margin-top: 10px;
    }
    .activity-a {
      width: 18px;
      height: 19px;
      background: linear-gradient(
        135deg,
        rgba(235, 110, 117, 1) 0%,
        rgba(247, 166, 83, 1) 100%
      );
      border-radius: 4px;
      padding: 0;
      padding-left: 5px;
      margin-right: 9px;
    }
    .activity-b {
      width: 18px;
      height: 19px;
      padding: 0;
      padding-left: 4px;
      background: linear-gradient(
        135deg,
        rgba(176, 70, 157, 1) 0%,
        rgba(97, 72, 170, 1) 100%
      );
      border-radius: 4px;
      margin-right: 9px;
      padding-right: -5px;
    }
    .activity-c {
      width: 18px;
      height: 19px;
      padding: 0;
      padding-left: 4px;
      background: linear-gradient(
        135deg,
        rgba(50, 36, 149, 1) 0%,
        rgba(49, 56, 172, 1) 100%
      );
      border-radius: 4px;
      margin-right: 9px;
    }
  }
}
.tip {
  width: 18px;
  height: 16px;
  transform: translate(-278px, 2px) rotate(-90deg);
}
</style>
